<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<meta name="referrer" content="never">
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<t:datagrid name="rtList"
	actionUrl="wxReceiveTextController.do?datagrid" fit="true"
	fitColumns="true" idField="id" queryMode="group" title="回复信息">
	<t:dgCol title="编号" field="id" hidden="true"></t:dgCol>
	<t:dgCol title="图片地址" field="pictureUrl" hidden="true"></t:dgCol>
	<t:dgCol title="语音识别内容" field="recognition" hidden="true"></t:dgCol>
	<t:dgCol title="媒体标识" field="mediaId" hidden="true"></t:dgCol>
	<t:dgCol title="纬度" field="locationX" hidden="true"></t:dgCol>
	<t:dgCol title="经度" field="locationY" hidden="true"></t:dgCol>
	<t:dgCol title="位置说明" field="locationLabel" hidden="true"></t:dgCol>

	<t:dgCol title="openid" field="fromUserName" query="true" width="100"></t:dgCol>
	<t:dgCol title="类型" field="msgType" dictionary="wxmsgtype" query="true"
		width="35"></t:dgCol>
	<t:dgCol title="创建日期" field="createDate" formatter="yyyy-MM-dd" width="90"></t:dgCol>
	<t:dgCol title="内容" field="content" formatterjs="fmtContent"></t:dgCol>
	<t:dgCol title="回复内容" field="rescontent" width="100"></t:dgCol>
	<t:dgCol title="操作" field="opt" width="100"></t:dgCol>
	<t:dgDelOpt title="删除" url="wxReceiveTextController.do?del&id={id}" />
	<t:dgFunOpt title="快捷回复" funname="responseMessage(id)" />
</t:datagrid>

<script type="text/javascript">
  function responseMessage(id) {
    var url = "wxReceiveTextController.do?jumpsendmessage&id=" + id
    add("快捷回复", url, "rtList", 700, 400);
  }

  function fmtContent(value, row, index) {
    var type = row.msgType;
    var mediaId = row.mediaId;

    if ('image' == type) {
      // 绕过微信防盗链
      return "<a target='_blank' href='http://read.html5.qq.com/image?src=forum&q=5&r=0&imgflag=7&imageUrl="
          + row.pictureUrl
          + "'><img src='http://read.html5.qq.com/image?src=forum&q=5&r=0&imgflag=7&imageUrl="
          + row.pictureUrl + "' style='width: 60px; height: 60px;' ></a>"

    } else if ('voice' == type) {
      return "<a href='wxReceiveTextController.do?getMediaById&type=" + type
          + "&id=" + mediaId + "' style='color:blue;'>语音自动识别为:"
          + row.recognition + "</a>";

    } else if ('video' == type) {
      return "<a href='wxReceiveTextController.do?getMediaById&type=" + type
          + "&id=" + mediaId + "' style='color:blue;'>" + '点击下载视频' + "</a>";

    } else if ('location' == type) {
      return row.locationLabel + "(" + row.locationX + "," + row.locationY
          + ")";

    } else {
      return value;
    }
  }
</script>
